package com.gwm.item.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gwm.item.pojo.TbSku;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;


/**
 * <p>
 * sku表,该表表示具体的商品实体,如黑色的 64g的iphone 8 Mapper 接口
 * </p>
 *
 * @author heima
 * @since 2020-12-01
 */
public interface TbSkuMapper extends BaseMapper<TbSku> {
    @Update("update tb_sku set stock=stock-#{num} where id=#{skuId}")
    void stockMinus(@Param("num") Integer num, @Param("skuId") Long skuId);

    @Update("update tb_sku set stock=stock+#{num} where id=#{skuId}")
    void stockPlus(@Param("num") Integer num, @Param("skuId") Long skuId);
}
